package xiaodou.colorgame;


import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class SplashActivity extends Activity {

    EditText etName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
        etName = (EditText) findViewById(R.id.id_name_et);
        findViewById(R.id.id_goon_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if("".equals(etName.getText().toString().trim())){
                    Toast.makeText(SplashActivity.this,"请输入你的名字",Toast.LENGTH_SHORT).show();
                    return;
                }
                start();
            }
        });
    }

    public void start() {
        Intent intent = new Intent();
        intent.setClass(this, MainActivity.class);
        intent.putExtra("name",etName.getText().toString().trim());
        startActivity(intent);
        finish();
    }

}
